# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from .crypt_aes import aes_encrypt
from .crypt_rsa import rsa_encrypt
from .crypt_url import url_encrypt


def print_encrypt(tin, rsa_pub_key, aes_key, print_type, fp_code, fp_num, fp_amount):
    # print_type = 0: 发票打印，1: 清单打印，2: 批量打印，3: 清单批量打印
    aes_ok = aes_encrypt(aes_key, print_type, fp_code, fp_num, fp_amount)
    print('aes_ok', aes_ok, len(aes_ok))

    rsa_ok = rsa_encrypt(rsa_pub_key, aes_ok)
    print('rsa_ok', rsa_ok)

    url_ok = url_encrypt(tin, rsa_ok)

    print('url_ok', url_ok)

    return url_ok


# pass
#     tin = '91370700165446588H'
#     rsa_pub_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClj0t1b+O5Cq06d0yp4qZHM3OhNSmoaArC6qAhehT/DB23F/CCUSFrQCjADhOvCq+xu4JcNGQ1kpjhKVNb642QPlSDJ04QM/+3mKcu/WKLDZ+3zQYvNY41pcjTyxtUT9ixaBx8OQQfOp+qiAYYBtE9T6WRLCrl1YN0drpDvFylyQIDAQAB"

#     aes_key = 'OrUPI3VOgAvLtyxA'
#     print('aes_key', aes_key)

#     # print_type 0---发票打印，1---清单打印，2---批量打印，3-清单批量打印
#     print_type = '0'

#     fp_code = '037002200105'
#     fp_num = '05548060'
#     fp_amount = 54197.70

#     print('message',  print_type, fp_code, fp_num, fp_amount)
